package com.ruoyi.exam.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.exam.mapper.PQuestionRecordMapper;
import com.ruoyi.exam.domain.PQuestionRecord;
import com.ruoyi.exam.service.IPQuestionRecordService;

/**
 * 答题记录Service业务层处理
 *
 * @author jiadun
 * @date 2022-01-06
 */
@Service
public class PQuestionRecordServiceImpl implements IPQuestionRecordService
{
    @Autowired
    private PQuestionRecordMapper pQuestionRecordMapper;

    /**
     * 查询答题记录
     *
     * @param id 答题记录主键
     * @return 答题记录
     */
    @Override
    public PQuestionRecord selectPQuestionRecordById(Long id)
    {
        return pQuestionRecordMapper.selectPQuestionRecordById(id);
    }

    /**
     * 查询答题记录列表
     *
     * @param pQuestionRecord 答题记录
     * @return 答题记录
     */
    @Override
    public List<PQuestionRecord> selectPQuestionRecordList(PQuestionRecord pQuestionRecord)
    {
        return pQuestionRecordMapper.selectPQuestionRecordList(pQuestionRecord);
    }

    /**
     * 新增答题记录
     *
     * @param pQuestionRecord 答题记录
     * @return 结果
     */
    @Override
    public int insertPQuestionRecord(PQuestionRecord pQuestionRecord)
    {
        pQuestionRecord.setCreateTime(DateUtils.getNowDate());
        return pQuestionRecordMapper.insertPQuestionRecord(pQuestionRecord);
    }

    /**
     * 修改答题记录
     *
     * @param pQuestionRecord 答题记录
     * @return 结果
     */
    @Override
    public int updatePQuestionRecord(PQuestionRecord pQuestionRecord)
    {
        pQuestionRecord.setUpdateTime(DateUtils.getNowDate());
        return pQuestionRecordMapper.updatePQuestionRecord(pQuestionRecord);
    }

    /**
     * 批量删除答题记录
     *
     * @param ids 需要删除的答题记录主键
     * @return 结果
     */
    @Override
    public int deletePQuestionRecordByIds(Long[] ids)
    {
        return pQuestionRecordMapper.deletePQuestionRecordByIds(ids);
    }

    /**
     * 删除答题记录信息
     *
     * @param id 答题记录主键
     * @return 结果
     */
    @Override
    public int deletePQuestionRecordById(Long id)
    {
        return pQuestionRecordMapper.deletePQuestionRecordById(id);
    }

    @Override
    public int selectPQuestionRecordByCount(PQuestionRecord pQuestionRecord) {
        return pQuestionRecordMapper.selectPQuestionRecordByCount(pQuestionRecord);
    }

  @Override
    public int deletePQuestionRecordByQAC(PQuestionRecord pQuestionRecord) {
      return pQuestionRecordMapper.deletePQuestionRecordByQAC(pQuestionRecord);
    }
}
